from Server import const
from Server.Handlers.index import IndexHandle
from Server.Handlers.son import SonHandle
from Server.Handlers.upload import UploadHandle

# 路由表
table = []


def initRouteTable(config: dict):
    table.append((const.UploadRoute, UploadHandle))  # 上传文件
    table.append((const.UploadRoute + '/', UploadHandle))  # 上传文件

    for sub in config['route_path']['sub']:
        table.append((sub['route'] + '/([\\w\\W]+)', SonHandle))
        table.append((sub['route'], IndexHandle))
        table.append((sub['route'] + '/', IndexHandle))

    table.append(('/([\\w\\W]+)', SonHandle))
    table.append(('/', IndexHandle))
